import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { lotpassageVO, lotpassageForm, lotpassageQuery } from '@/api/parkinglot/lotPassage/types';

/**
 * 查询停车场-通道列表
 * @param query
 * @returns {*}
 */

export const listlotpassage = (query?: lotpassageQuery): AxiosPromise<lotpassageVO[]> => {
  return request({
    url: '/parkinglot/lotPassage/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询停车场-通道详细
 * @param parkingLotPassageId
 */
export const getlotpassage = (parkingLotPassageId: string | number): AxiosPromise<lotpassageVO> => {
  return request({
    url: '/parkinglot/lotPassage/' + parkingLotPassageId,
    method: 'get'
  });
};

/**
 * 新增停车场-通道
 * @param data
 */
export const addlotpassage = (data: lotpassageForm) => {
  return request({
    url: '/parkinglot/lotPassage',
    method: 'post',
    data: data
  });
};

/**
 * 修改停车场-通道
 * @param data
 */
export const updatelotpassage = (data: lotpassageForm) => {
  return request({
    url: '/parkinglot/lotPassage',
    method: 'put',
    data: data
  });
};

/**
 * 删除停车场-通道
 * @param parkingLotPassageId
 */
export const dellotpassage = (parkingLotPassageId: string | number | Array<string | number>) => {
  return request({
    url: '/parkinglot/lotPassage/' + parkingLotPassageId,
    method: 'delete'
  });
};
